package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.goods.pojo.Sku;
import com.changgou.util.TokenDecode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/****
 * @Author:传智播客
 * @Description:
 * @Date 2019/6/18 13:58
 *****/

 /**
  * @author ShortDust
  * @Description
  * @FeignClient 代表当前的未知的的 goods
  * @ClassName SkuFeign
  * @date 2019/11/15 20:57
  * @return
 */
@FeignClient(name="goods")
@RequestMapping("/sku")
@CrossOrigin
public interface SkuFeign {

     /**
      *  扣除库存
      * @param num
      * @return
      */
     @GetMapping("/decrCount/{skuId}/{num}")
     Result decrCount(
             @PathVariable(name = "skuId") Long skuId,
             @PathVariable(name = "num") Integer num);

     /***
      * 根据ID查询Sku数据
      * @param id
      * @return
      */
     @GetMapping("/{id}")
     Result<Sku> findById(@PathVariable("id") Long id);


    /**
     * @author ShortDust
     * @Description     根据商品的状态为1查询所有的商品
     * @ClassName SkuController
     * @date 2019/11/15 19:08
     * @return
     */
    @GetMapping("/findSkusByStatus/{status}")
    public List<Sku> findSkusByStatus(@PathVariable(value = "status") String status);

}